import http from '@/utils/http/axios'
import {ContentTypeEnum} from '@/enums/httpEnum'

enum Api {
    bawlistList = '/bawlist/list',
    bawlistCreate = '/bawlist/create',
    bawlistDelete = '/bawlist/delete',
    bawlistUpdate = '/bawlist/update',
    bawlistInTemp = '/bawlist/intemp',
    whiteUpdateTemp = '/bawlist/white/updatetemp',
    blackUpdateTemp = '/bawlist/black/updatetemp',
}

/**
 * @description: 修改
 */
export function bawlistUpdate(params: any) {
    return http.request({
        url: Api.bawlistUpdate,
        method: 'POST',
        params,
    },{
        isTransformRequestResult: false,
        isParseToJson: true,
        isShowMessage: true,
        successMessageText: '修改成功',
        errorMessageText: '修改失败'
    })
}

/**
 * @description: 删除
 */
export function bawlistDelete(params: any, option: any) {
    return http.request({
        url: Api.bawlistDelete,
        method: 'POST',
        params,
    },{
        ...option,
        isTransformRequestResult: false,
        successMessageText: '删除成功',
        errorMessageText: '删除失败'
    })
}

/**
 * @description: 添加
 */
export function bawlistCreate(params: any) {
    return http.request({
        url: Api.bawlistCreate,
        method: 'POST',
        params,
    },{
        isTransformRequestResult: false,
        isParseToJson: true,
        isShowMessage: true,
        successMessageText: '添加成功',
        errorMessageText: '添加失败'
    })
}

/**
 * @description: 获取
 */
export function bawlistList(params: any) {
    return http.request({
        url: Api.bawlistList,
        method: 'GET',
        params,
    },{
        isTransformRequestResult: false
    })
}

export function whitelistInTemp(tempid: number){
    return http.request({
        url: Api.bawlistInTemp,
        method: 'POST',
        params:{"tempid":tempid,"type":1},
    })
}

export function blacklistInTemp(tempid: number){
    return http.request({
        url: Api.bawlistInTemp,
        method: 'POST',
        params:{"tempid":tempid,"type":2},
    })
}

export function whiteUpdateTemp(params: any){
    return http.request({
        url: Api.whiteUpdateTemp,
        method: "POST",
        params,
    })
}

export function blackUpdateTemp(params: any){
    return http.request({
        url: Api.blackUpdateTemp,
        method: "POST",
        params,
    })
}
